<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%
    // 检查用户是否登录且是雇主角色
    Integer userId = (Integer) session.getAttribute("userId");
    Integer userRole = (Integer) session.getAttribute("userRole");
    String userName = (String) session.getAttribute("userName");

    if (userId == null) {
        response.sendRedirect("login.jsp");
        return;
    }

    if (userRole != 0) { // 0表示雇主角色
        response.sendRedirect("access-denied.jsp");
        return;
    }
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>雇主工作台</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Microsoft YaHei', sans-serif;
        }

        body {
            background-color: #f5f7fa;
            padding: 20px;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding: 20px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
        }

        .welcome {
            font-size: 24px;
            color: #2c3e50;
        }

        .welcome strong {
            color: #3498db;
        }

        .logout {
            color: #e74c3c;
            text-decoration: none;
            font-weight: 500;
        }

        .logout:hover {
            text-decoration: underline;
        }

        .dashboard-title {
            font-size: 22px;
            color: #2c3e50;
            margin-bottom: 20px;
            padding-left: 20px;
        }

        .dashboard-menu {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 25px;
            padding: 0 20px;
        }

        .menu-item {
            background: white;
            border-radius: 10px;
            padding: 25px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
            text-align: center;
        }

        .menu-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }

        .menu-icon {
            font-size: 48px;
            color: #3498db;
            margin-bottom: 15px;
        }

        .menu-item h3 {
            font-size: 18px;
            color: #2c3e50;
            margin-bottom: 10px;
        }

        .menu-item p {
            color: #7f8c8d;
            font-size: 14px;
            margin-bottom: 20px;
        }

        .menu-item a {
            display: inline-block;
            padding: 10px 20px;
            background: #3498db;
            color: white;
            border-radius: 5px;
            text-decoration: none;
            font-weight: 500;
            transition: all 0.3s;
        }

        .menu-item a:hover {
            background: #2980b9;
        }

        @media (max-width: 768px) {
            .header {
                flex-direction: column;
                text-align: center;
                gap: 15px;
            }

            .dashboard-menu {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <div class="welcome">欢迎回来，<strong><%= userName %></strong>！</div>
            <a href="logout" class="logout">退出登录</a>
        </div>

        <h2 class="dashboard-title">雇主功能菜单</h2>

        <div class="dashboard-menu">
            <div class="menu-item">
                <div class="menu-icon">🔍</div>
                <h3>浏览保姆</h3>
                <p>查看可用的保姆信息，筛选符合您需求的保姆</p>
                <a href="browse-nannies.jsp">查看保姆列表</a>
            </div>

            <div class="menu-item">
                <div class="menu-icon">📝</div>
                <h3>我的预订</h3>
                <p>查看和管理您的预订记录</p>
                <a href="my-bookings.jsp">查看我的预订</a>
            </div>

            <div class="menu-item">
                <div class="menu-icon">👤</div>
                <h3>个人资料</h3>
                <p>修改您的个人信息和联系方式</p>
                <a href="profile.jsp">编辑个人资料</a>
            </div>

            <div class="menu-item">
                <div class="menu-icon">❓</div>
                <h3>帮助中心</h3>
                <p>获取使用帮助和支持</p>
                <a href="help.jsp">获取帮助</a>
            </div>
        </div>
    </div>
</body>
</html>